﻿
using Mono.Cecil;

public abstract class LuaParameterReference : LuaVarReference
{
    private readonly ParameterReference _self;
    private LuaTypeReference _type;

    public LuaParameterReference(LuaModuleDefinition module, ParameterReference self)
        : base(module)
    {
        _self = self;
        if (self.Index == -1)
            Name = "self";
        else
            Name = ToName(self.Name);
    }
    public int Index { get; }
    public virtual LuaTypeReference Type
        => _type ?? (_type = GetTypeReference(_self.ParameterType));
    public abstract LuaArgDefinition Resolve();
}

